home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / gtksourceview-2.0 / language-specs / rpmspec.lang < prev    next >
Extensible Markup Language  |  2009-10-02  |  7KB  |  205 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.  Author: Konstantin Ryabitsev <icon@fedoraproject.org>
  5.  Copyright (C) 2007 Konstantin Ryabitsev <icon@fedoraproject.org>
  6.  
  7.  This library is free software; you can redistribute it and/or
  8.  modify it under the terms of the GNU Library General Public
  9.  License as published by the Free Software Foundation; either
  10.  version 2 of the License, or (at your option) any later version.
  11.  
  12.  This library is distributed in the hope that it will be useful,
  13.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  Library General Public License for more details.
  16.  
  17.  You should have received a copy of the GNU Library General Public
  18.  License along with this library; if not, write to the
  19.  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.  Boston, MA 02111-1307, USA.
  21.  
  22. -->
  23. <language id="rpmspec" _name="RPM spec" version="2.0" _section="Others">
  24.   <metadata>
  25.     <property name="mimetypes">text/x-rpm-spec</property>
  26.     <property name="globs">*.spec</property>
  27.     <property name="line-comment-start">#</property>
  28.   </metadata>
  29.  
  30.   <styles>
  31.     <style id="define" _name="Define" map-to="def:preprocessor"/>
  32.     <style id="header" _name="Header" map-to="def:keyword"/>
  33.     <style id="section" _name="Section" map-to="def:type"/>
  34.     <style id="spec-macro" _name="Spec Macro" map-to="def:preprocessor"/>
  35.     <style id="directory-macro" _name="Directory Macro" map-to="def:identifier"/>
  36.     <style id="command-macro" _name="Command Macro" map-to="def:identifier"/>
  37.     <style id="conditional-macro" _name="Conditional Macro" map-to="def:preprocessor"/>
  38.     <style id="other-macro" _name="Other Macro" map-to="def:identifier"/>
  39.     <style id="flow-conditional" _name="Flow Conditional" map-to="def:preprocessor"/>
  40.     <style id="rpm-var" _name="RPM Variable" map-to="def:identifier"/>
  41.     <style id="switch" _name="Switch" map-to="def:operator"/>
  42.     <style id="changelog-date" _name="Date" map-to="changelog:date"/>
  43.     <style id="changelog-email" _name="Email" map-to="changelog:email"/>
  44.   </styles>
  45.  
  46.   <definitions>
  47.  
  48.     <context id="define" style-ref="define" end-at-line-end="true">
  49.       <start>%define</start>
  50.       <include>
  51.         <context ref="def:line-continue" ignore-style="true"/>
  52.       </include>
  53.     </context>
  54.  
  55.     <context id="conditional-define" style-ref="define" end-at-line-end="true">
  56.       <start>%\{\!\?.*%define</start>
  57.       <end>\}</end>
  58.       <include>
  59.         <context ref="def:line-continue" ignore-style="true"/>
  60.       </include>
  61.     </context>
  62.  
  63.     <context id="header" style-ref="header">
  64.       <prefix>^</prefix>
  65.       <suffix>:</suffix>
  66.       <keyword>Name</keyword>
  67.       <keyword>Version</keyword>
  68.       <keyword>Release</keyword>
  69.       <keyword>Epoch</keyword>
  70.       <keyword>Summary</keyword>
  71.       <keyword>Group</keyword>
  72.       <keyword>License</keyword>
  73.       <keyword>Packager</keyword>
  74.       <keyword>Vendor</keyword>
  75.       <keyword>Icon</keyword>
  76.       <keyword>URL</keyword>
  77.       <keyword>Patch[0-9]*</keyword>
  78.       <keyword>Source[0-9]*</keyword>
  79.       <keyword>Requires\(?[a-z]*\)?</keyword>
  80.       <keyword>[A-Za-z]+Req</keyword>
  81.       <keyword>Obsoletes</keyword>
  82.       <keyword>Provides</keyword>
  83.       <keyword>Conflicts</keyword>
  84.       <keyword>Build[A-Za-z]+</keyword>
  85.       <keyword>[A-Za-z]+Arch</keyword>
  86.       <keyword>Auto[A-Za-z]+</keyword>
  87.     </context>
  88.  
  89.     <context id="section" style-ref="section">
  90.       <prefix>^%</prefix>
  91.       <keyword>description</keyword>
  92.       <keyword>package</keyword>
  93.       <keyword>prep</keyword>
  94.       <keyword>build</keyword>
  95.       <keyword>install</keyword>
  96.       <keyword>clean</keyword>
  97.       <keyword>check</keyword>
  98.       <keyword>pre[a-z]*</keyword>
  99.       <keyword>post[a-z]*</keyword>
  100.       <keyword>trigger[a-z]*</keyword>
  101.       <keyword>files</keyword>
  102.       <!-- the "changelog" section is handled as a special
  103.            case below.
  104.            TODO: In the future it would be nice to do the
  105.            same for other sections to enforce that some of the
  106.            things are highlighted only when in the correct
  107.            section.
  108.       -->
  109.     </context>
  110.  
  111.     <context id="spec-macro" style-ref="spec-macro">
  112.       <prefix>%</prefix>
  113.       <keyword>defattr</keyword>
  114.       <keyword>docdir</keyword>
  115.       <keyword>doc</keyword>
  116.       <keyword>setup</keyword>
  117.       <keyword>config</keyword>
  118.       <keyword>configure</keyword>
  119.       <keyword>make</keyword>
  120.       <keyword>makeinstall</keyword>
  121.       <keyword>dir</keyword>
  122.       <keyword>ghost</keyword>
  123.       <keyword>patch[0-9]+</keyword>
  124.       <keyword>find_lang</keyword>
  125.       <keyword>exclude</keyword>
  126.     </context>
  127.  
  128.     <context id="directory-macro" style-ref="directory-macro">
  129.         <match>%\{?_([a-z_]+dir|[a-z_]+path|prefix)\}?</match>
  130.     </context>
  131.  
  132.     <context id="command-macro" style-ref="command-macro">
  133.         <match>%\{?__[a-z_]+\}?</match>
  134.     </context>
  135.  
  136.     <context id="conditional-macro" style-ref="conditional-macro">
  137.         <match>%\{\?[A-Za-z0-9_]+\}</match>
  138.     </context>
  139.  
  140.     <context id="other-macro" style-ref="other-macro">
  141.         <match>%\{[a-zA-Z][a-zA-Z0-9_]+\}</match>
  142.     </context>
  143.  
  144.     <context id="flow" style-ref="flow-conditional">
  145.       <prefix>%</prefix>
  146.       <keyword>ifarch</keyword>
  147.       <keyword>if</keyword>
  148.       <keyword>else</keyword>
  149.       <keyword>elif</keyword>
  150.       <keyword>endif</keyword>
  151.     </context>
  152.  
  153.     <context id="rpm-var" style-ref="rpm-var">
  154.         <match>\$\{?RPM_[A-Z0-9_]+\}?</match>
  155.     </context>
  156.  
  157.     <!-- TODO: this is one of the context which would be nice
  158.          to restrict to the proper sections -->
  159.     <context id="command-switch" style-ref="switch">
  160.         <match>\s(-\w+|--\w[a-zA-Z_-]+)</match>
  161.     </context>
  162.  
  163.     <define-regex id="weekday">Mon|Tue|Wed|Thu|Fri|Sat|Sun</define-regex>
  164.     <define-regex id="month">Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec</define-regex>
  165.     <define-regex id="date" extended="true">
  166.       \%{weekday}\s+\%{month}\s+\d{1,2}\s+(\d{1,2}:\d{1,2}:\d{1,2}\s+)?\d{4} |   # Wed Jun 27 13:27:21 2007
  167.       \d{4}-\d{2}-\d{2}                                                          # 2007-06-28
  168.     </define-regex>
  169.  
  170.     <context id="changelog-section">
  171.       <start>%changelog</start>
  172.       <end>^(?=%)</end>
  173.       <include>
  174.         <context sub-pattern="0" where="start" style-ref="section"/>
  175.         <context id="date" style-ref="changelog-date">
  176.           <match>\%{date}</match>
  177.         </context>
  178.         <context id="email" style-ref="changelog-email">
  179.           <match><[A-Za-z0-9._+-]+@[A-Za-z0-9._+-]+\.[A-Za-z0-9]{2,4}></match>
  180.         </context>
  181.       </include>
  182.     </context>
  183.  
  184.     <context id="rpmspec">
  185.       <include>
  186.         <context ref="def:shell-like-comment"/>
  187.         <context ref="define"/>
  188.         <context ref="header"/>
  189.         <context ref="section"/>
  190.         <context ref="spec-macro"/>
  191.         <context ref="directory-macro"/>
  192.         <context ref="command-macro"/>
  193.         <context ref="conditional-macro"/>
  194.         <context ref="other-macro"/>
  195.         <context ref="flow"/>
  196.         <context ref="rpm-var"/>
  197.         <context ref="command-switch"/>
  198.         <context ref="changelog-section"/>
  199.       </include>
  200.     </context>
  201.  
  202.   </definitions>
  203.  
  204. </language>
  205.